<template>
    <el-card class="el-cards">

        <el-row>
            <el-col :span="18">
                <div class="header-left">
                    <div class="userHeade-box">
                        <img class="userHeade" src="http://web.quanjiu.net/care/img/log.B149UREi.png" alt="">
                    </div>

                    <div class="userWelcome">
                        <p class="">下午好，admin!</p>

                        <p class="userWelcomeText">北京市 阴 当前温度：20℃</p>
                    </div>
                </div>
            </el-col>
            <el-col :span="6">
                <div class="header-right">
                    <div class="statistics">
                        <div class="statistics-name">
                            <img class="statistics-img" src="" alt="">
                            <p>机构数</p>
                        </div>
                        <div class="statistics-num">
                            <p>738</p>
                        </div>
                    </div>

                    <div class="statistics">
                        <div class="statistics-name">
                            <img class="statistics-img" src="" alt="">
                            <p>床位数</p>
                        </div>
                        <div class="statistics-num">
                            <p>954</p>
                        </div>
                    </div>

                    <div class="statistics">
                        <div class="statistics-name">
                            <img class="statistics-img" src="" alt="">
                            <p>老人数</p>
                        </div>
                        <div class="statistics-num">
                            <p>741</p>
                        </div>
                    </div>
                </div>
            </el-col>
        </el-row>
    </el-card>


    <div class="table-box">
        <el-card class="table-echars">
            <div id="mainLeft">

            </div>
        </el-card>

        <el-card class="table-echars">
            <div id="mainRight">

            </div>
        </el-card>
    </div>

</template>

<script setup lang='ts'>
import { ref, reactive, onMounted } from 'vue';
import * as echarts from 'echarts';


onMounted(() => {
    echartsInitLeft()
    echartsInitRight()
})

// 左边图标
const echartsInitLeft = () => {
    // 基于准备好的dom，初始化echarts实例
    let myChart = echarts.init(document.getElementById('mainLeft'));

    // 指定图表的配置项和数据
    let option = {
        title: {
            text: '出院、入院、预定、统计'
        },
        tooltip: {},
        legend: {
            data: ['销量']
        },
        xAxis: {
            data: ['衬衫', '羊毛衫', '雪纺衫', '裤子', '高跟鞋', '袜子']
        },
        yAxis: {},
        series: [
            {
                name: '销量',
                type: 'bar',
                data: [5, 20, 36, 10, 10, 20]
            }
        ]
    };

    // 使用刚指定的配置项和数据显示图表。
    myChart.setOption(option);
}


// 右边图标
const echartsInitRight = () => {
    // 基于准备好的dom，初始化echarts实例
    let myChart = echarts.init(document.getElementById('mainRight'));

    // 指定图表的配置项和数据
    let option = {
        title: {
            text: '各年龄段数量统计'
        },
        tooltip: {
            trigger: 'item'
        },
        legend: {
            top: '5%',
            left: 'center'
        },
        series: [
            {
                name: 'Access From',
                type: 'pie',
                radius: ['40%', '70%'],
                avoidLabelOverlap: false,
                label: {
                    show: false,
                    position: 'center'
                },
                emphasis: {
                    label: {
                        show: true,
                        fontSize: 40,
                        fontWeight: 'bold'
                    }
                },
                labelLine: {
                    show: false
                },
                data: [
                    { value: 1048, name: 'Search Engine' },
                    { value: 735, name: 'Direct' },
                    { value: 580, name: 'Email' },
                    { value: 484, name: 'Union Ads' },
                    { value: 300, name: 'Video Ads' }
                ]
            }
        ]
    };

    // 使用刚指定的配置项和数据显示图表。
    myChart.setOption(option);
}





</script>

<style scoped lang='less'>
.el-row {
    margin-bottom: 20px;
}

.el-row:last-child {
    margin-bottom: 0;
}

.el-col {
    border-radius: 4px;
}

.grid-content {
    border-radius: 4px;
    min-height: 36px;
}



.el-cards {

    .header-left {
        display: flex;

        .userHeade-box{
            width: 65px;
            height: 65px;
            margin-right: 20px;

            .userHeade{
                width: 100%;
                height: 100%;
            }
        }

        .userWelcome{
            font-size: 12px;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            padding-top: 5px;
            padding-bottom: 5px;

            .userWelcomeText{
                color: rgb(157 164 176);
            }
        }

    }

    .header-right {
        // width: 600px;
        // background-color: red;
        display: flex;
        justify-content: space-between;

        .statistics{
            display: flex;
            flex-direction: column;
            justify-content: center;
            height: 65px;
            font-size: 14px;
            color: #606266;
            // background-color: aqua;

            .statistics-name{
                display: flex;
                margin-bottom: 4px;
                
                .statistics-img{
                    width: 20px;
                    height: 20px;
                }
            }

            .statistics-num{
                font-size: 16px;
                color: #303133;
            }
        }
    }

}


.table-box {
    display: flex;
    margin-top: 20px;
    justify-content: space-between;

    .table-echars {
        width: 49.5%;
        height: 540px;

        #mainLeft, #mainRight {
            width: 100%;
            height: 500px;
            // background-color: red;
        }
    }

}
</style>